<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="generator" content="Docusaurus v2.0.0-alpha.54">
<link rel="preconnect" href="https://www.google-analytics.com">
<script>window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)},ga.l=+new Date,ga("create","UA-128126650-1","auto"),ga("send","pageview")</script>
<script async src="https://www.google-analytics.com/analytics.js"></script>
<link rel="preconnect" href="https://www.google-analytics.com">
<link rel="preconnect" href="https://www.googletagmanager.com">
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-128126650-1"></script>
<script>function gtag(){dataLayer.push(arguments)}window.dataLayer=window.dataLayer||[],gtag("js",new Date),gtag("config","UA-128126650-1",{})</script>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,400;0,700;1,400&family=Roboto:wght@900&display=swap">

<title data-react-helmet="true">API Concepts | gulp.js</title>

<meta data-react-helmet="true" name="twitter:card" content="summary_large_image"><meta data-react-helmet="true" property="og:title" content="API Concepts | gulp.js"><meta data-react-helmet="true" name="description" content="# Concepts"><meta data-react-helmet="true" property="og:description" content="# Concepts"><meta data-react-helmet="true" property="og:url" content="https://gulpjs.com//docs/en/api/concepts">

<link data-react-helmet="true" rel="shortcut icon" href="/img/favicon.png">


<link rel="stylesheet" href="/styles.8121b95c.css">


<link rel="preload" href="/styles.10c0193b.js" as="script">

<link rel="preload" href="/runtime~main.ae01ffbb.js" as="script">

<link rel="preload" href="/main.3e1928f1.js" as="script">

<link rel="preload" href="/1.fe6bacd8.js" as="script">

<link rel="preload" href="/2.77a8f44b.js" as="script">

<link rel="preload" href="/1be78505.2d41add8.js" as="script">

<link rel="preload" href="/37.ee8d4ee9.js" as="script">

<link rel="preload" href="/10002e1b.63b80d46.js" as="script">

<link rel="preload" href="/17896441.f1e2ba83.js" as="script">

<link rel="preload" href="/c542914c.191b84a0.js" as="script">

</head>
<body>

<div id="__docusaurus">
<nav class="navbar navbar--light navbar--fixed-top"><div class="navbar__inner"><div class="navbar__items"><a class="navbar__brand" target="_self" href="/"><img class="navbar__logo" src="/img/gulp.svg" alt="gulp"></a><a activeclassname="navbar__link--active" class="navbar__item navbar__link noWrap_BxdH" href="/docs/en/getting-started/quick-start">Get Started</a><a activeclassname="navbar__link--active" class="navbar__item navbar__link noWrap_BxdH" href="/docs/en/api/concepts">API</a><a activeclassname="navbar__link--active" class="navbar__item navbar__link noWrap_BxdH" href="/plugins">Plugins</a><a target="_blank" rel="noopener noreferrer" href="https://github.com/sponsors/gulpjs" class="navbar__item navbar__link noWrap_BxdH">Donate</a><a activeclassname="navbar__link--active" class="navbar__item navbar__link emphasis_1Gl9 noWrap_BxdH" href="/docs/en/support/for-enterprise">Enterprise</a></div><div class="navbar__items navbar__items--right"><a target="_blank" rel="noopener noreferrer" href="https://twitter.com/gulpjs" class="navbar__item navbar__link navbar__link--icon noWrap_BxdH"><img class="navbarIcon_2_MD" src="/img/twitter.svg" alt="Gulp on Twitter"></a><a target="_blank" rel="noopener noreferrer" href="https://medium.com/gulpjs" class="navbar__item navbar__link navbar__link--icon noWrap_BxdH"><img class="navbarIcon_2_MD" src="/img/medium.svg" alt="The gulp blog"></a><div class="navbar__search"><span aria-label="expand searchbar" role="button" class="search-icon search-icon-hidden" tabindex="0"></span><input type="search" id="search_input_react" placeholder="Search" aria-label="Search" class="navbar__search-input search-bar-expanded"></div></div></div></nav><div class="main-wrapper"><div class="docPage_1kjD"><div class="docSidebarContainer_1cYp"><div class="sidebar_1kLs"><div class="menu menu--responsive menu_w2sC"><button aria-label="Open Menu" aria-haspopup="true" class="button button--secondary button--sm menu__button" type="button"><svg aria-label="Menu" class="sidebarMenuIcon_2vk4" xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 32 32" role="img" focusable="false"><title>Menu</title><path stroke="currentColor" stroke-linecap="round" stroke-miterlimit="10" stroke-width="2" d="M4 7h22M4 15h22M4 23h22"></path></svg></button><ul class="menu__list"><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Getting Started</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/getting-started/quick-start">Quick Start</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/getting-started/javascript-and-gulpfiles">JavaScript and Gulpfiles</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/getting-started/creating-tasks">Creating Tasks</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/getting-started/async-completion">Async Completion</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/getting-started/working-with-files">Working with Files</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/getting-started/explaining-globs">Explaining Globs</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/getting-started/using-plugins">Using Plugins</a></li><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/getting-started/watching-files">Watching Files</a></li></ul></li><li class="menu__list-item"><a class="menu__link menu__link--sublist menu__link--active" href="#!">API</a><ul class="menu__list"><li class="menu__list-item"><a aria-current="page" class="menu__link menu__link--active" tabindex="0" href="/docs/en/api/concepts">Concepts</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/src">src()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/dest">dest()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/symlink">symlink()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/lastrun">lastRun()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/series">series()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/parallel">parallel()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/watch">watch()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/task">task()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/registry">registry()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/tree">tree()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/vinyl">Vinyl</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/vinyl-isvinyl">Vinyl.isVinyl()</a></li><li class="menu__list-item"><a class="menu__link" tabindex="0" href="/docs/en/api/vinyl-iscustomprop">Vinyl.isCustomProp()</a></li></ul></li><li class="menu__list-item menu__list-item--collapsed"><a class="menu__link menu__link--sublist" href="#!">Support</a><ul class="menu__list"><li class="menu__list-item"><a class="menu__link" tabindex="-1" href="/docs/en/support/for-enterprise">For Enterprise</a></li></ul></li></ul></div></div></div><main class="docMainContainer_FFX1"><div class="container padding-vert--lg docItemWrapper_1cc7"><div class="row"><div class="col docItemCol_2GOA"><div class="docItemContainer_2cwg"><article><div class="markdown"><h1><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="concepts"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#concepts" title="Direct link to heading">#</a>Concepts</h1><p>The following concepts are prerequisites to understanding the API docs. They will be referenced throughout, refer back to this page for detailed explanations.</p><p>If you&#x27;re new here, begin with the <a href="/docs/en/getting-started/quick-start">Getting Started Guide</a>.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="vinyl"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#vinyl" title="Direct link to heading">#</a>Vinyl</h2><p>Vinyl is a metadata object that describes a file. The main properties of a Vinyl instance are <code>path</code> and <code>contents</code> - core aspects of a file on your file system. Vinyl objects can be used to describe files from many sources - on a local file system or any remote storage option.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="vinyl-adapters"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#vinyl-adapters" title="Direct link to heading">#</a>Vinyl adapters</h2><p>While Vinyl provides a way to describe a file, a way to access these files is needed. Each file source is accessed using a Vinyl adapter.</p><p>An adapter exposes:</p><ul><li>A method with the signature <code>src(globs, [options])</code> and returns a stream that produces Vinyl objects.</li><li>A method with the signature <code>dest(folder, [options])</code> and returns a stream that consumes Vinyl objects.</li><li>Any extra methods specific to their input/output medium - such as the <code>symlink</code> method <code>vinyl-fs</code> provides. They should always return streams that produce and/or consume Vinyl objects.</li></ul><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="tasks"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#tasks" title="Direct link to heading">#</a>Tasks</h2><p>Each gulp task is an asynchronous JavaScript function that either accepts an error-first callback or returns a stream, promise, event emitter, child process, or observable. Due to some platform limitations, synchronous tasks aren&#x27;t supported.</p><p>For a more detailed explanation, see <a href="/docs/en/getting-started/creating-tasks">Creating Tasks</a>.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="globs"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#globs" title="Direct link to heading">#</a>Globs</h2><p>A glob is a string of literal and/or wildcard characters, like <code>*</code>, <code>**</code>, or <code>!</code>, used to match filepaths. Globbing is the act of locating files on a file system using one or more globs.</p><p>If you don&#x27;t have experience with globs, see <a href="/docs/en/getting-started/explaining-globs">Explaining Globs</a>.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="glob-base"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#glob-base" title="Direct link to heading">#</a>Glob base</h2><p>A glob base - sometimes called glob parent - is the path segment before any special characters in a glob string. As such, the glob base of <code>/src/js/**.js</code> is <code>/src/js/</code>.  All paths that match the glob are guaranteed to share the glob base - that path segment can&#x27;t be variable.</p><p>Vinyl instances generated by <code>src()</code> are constructed with the glob base set as their <code>base</code> property. When written to the file system with <code>dest()</code>, the <code>base</code> will be removed from the output path to preserve directory structures.</p><p>For more in depth information, see the <a href="https://github.com/es128/glob-parent">glob-parent</a> repository.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="file-system-stats"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#file-system-stats" title="Direct link to heading">#</a>File system stats</h2><p>File metadata is provided as an instance of Node&#x27;s <a href="https://nodejs.org/api/fs.html#fs_class_fs_stats"><code>fs.Stats</code></a>. It is available as the <code>stat</code> property on your Vinyl instances and used internally to determine if a Vinyl object represents a directory or symbolic link. When written to the file system, permissions and time values are synchronized from the Vinyl object&#x27;s <code>stat</code> property.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="file-system-modes"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#file-system-modes" title="Direct link to heading">#</a>File system modes</h2><p>File system modes determine what permissions exist for a file. Most files and directories on your file system will have a fairly permissive mode, allowing gulp to read/write/update files on your behalf. By default, gulp will create files with the same permissions as the running process, but you can configure the modes through options in <code>src()</code>, <code>dest()</code>, etc. If you&#x27;re experiencing permission (EPERM) issues, check the modes on your files.</p><h2><a aria-hidden="true" tabindex="-1" class="anchor enhancedAnchor_ZqCz" id="modules"></a><a aria-hidden="true" tabindex="-1" class="hash-link" href="#modules" title="Direct link to heading">#</a>Modules</h2><p>Gulp is made up of many small modules that are pulled together to work cohesively. By utilizing <a href="https://semver.org">semver</a> within the small modules, we can release bug fixes and features without publishing new versions of gulp. Often, when you don&#x27;t see progress on the main repository, work is being done in one of these modules.</p><p>If you&#x27;re having trouble, ensure your current modules are updated using the <code>npm update</code> command. If the problem persists, open an issue on the individual project repository.</p><ul><li><a href="https://github.com/gulpjs/undertaker">undertaker</a> - the task registration system</li><li><a href="https://github.com/gulpjs/vinyl">vinyl</a> - the virtual file objects</li><li><a href="https://github.com/gulpjs/vinyl-fs">vinyl-fs</a> - a vinyl adapter to your local file system</li><li><a href="https://github.com/gulpjs/glob-watcher">glob-watcher</a> - the file watcher</li><li><a href="https://github.com/gulpjs/bach">bach</a> - task orchestration using <code>series()</code> and <code>parallel()</code></li><li><a href="https://github.com/gulpjs/last-run">last-run</a> - tracks the last run time of a task</li><li><a href="https://github.com/gulpjs/vinyl-sourcemap">vinyl-sourcemap</a> - built-in sourcemap support</li><li><a href="https://github.com/gulpjs/gulp-cli">gulp-cli</a> - the command line interface for interacting with gulp</li></ul></div></article><div class="margin-vert--lg"><nav class="pagination-nav"><div class="pagination-nav__item"><a class="pagination-nav__link" href="/docs/en/getting-started/watching-files"><div class="pagination-nav__link--sublabel">Previous</div><div class="pagination-nav__link--label">« Watching Files</div></a></div><div class="pagination-nav__item pagination-nav__item--next"><a class="pagination-nav__link" href="/docs/en/api/src"><div class="pagination-nav__link--sublabel">Next</div><div class="pagination-nav__link--label">src() »</div></a></div></nav></div></div></div><div class="col col--3"><div class="tableOfContents_TbNY"><ul class="contents contents__left-border"><li><a href="#vinyl" class="contents__link">Vinyl</a></li><li><a href="#vinyl-adapters" class="contents__link">Vinyl adapters</a></li><li><a href="#tasks" class="contents__link">Tasks</a></li><li><a href="#globs" class="contents__link">Globs</a></li><li><a href="#glob-base" class="contents__link">Glob base</a></li><li><a href="#file-system-stats" class="contents__link">File system stats</a></li><li><a href="#file-system-modes" class="contents__link">File system modes</a></li><li><a href="#modules" class="contents__link">Modules</a></li></ul></div></div></div></div></main></div></div><footer class="footer"><div class="container"><div class="row footer__links"><div class="col footer__col"><ul class="footer__items"><li class="footer__item"><img src="/img/gulp-white-logo.svg" alt="gulp" href="/"></li></ul></div><div class="col footer__col"><h4 class="footer__title">Docs</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" href="/docs/en/getting-started/quick-start">Getting Started</a></li><li class="footer__item"><a class="footer__link-item" href="/docs/en/api/concepts">API</a></li></ul></div><div class="col footer__col"><h4 class="footer__title">Community</h4><ul class="footer__items"><li class="footer__item"><a class="footer__link-item" target="_blank" rel="noopener noreferrer" href="https://github.com/gulpjs/gulp">GitHub</a></li><li class="footer__item"><a class="footer__link-item" target="_blank" rel="noopener noreferrer" href="https://stackoverflow.com/questions/tagged/gulp">Stack Overflow</a></li><li class="footer__item"><a class="footer__link-item" target="_blank" rel="noopener noreferrer" href="https://twitter.com/gulpjs">Twitter</a></li></ul></div></div><div class="text--center"><div></div></div></div></footer>
</div>

<script src="/styles.10c0193b.js"></script>

<script src="/runtime~main.ae01ffbb.js"></script>

<script src="/main.3e1928f1.js"></script>

<script src="/1.fe6bacd8.js"></script>

<script src="/2.77a8f44b.js"></script>

<script src="/1be78505.2d41add8.js"></script>

<script src="/37.ee8d4ee9.js"></script>

<script src="/10002e1b.63b80d46.js"></script>

<script src="/17896441.f1e2ba83.js"></script>

<script src="/c542914c.191b84a0.js"></script>


</body>
</html>